Create ChunkedTransaction class#2389
Conversation
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #2389 +/- ##
==========================================
+ Coverage 94.98% 94.99% +0.01%
==========================================
Files 163 164 +1
Lines 10464 10447 -17
==========================================
- Hits 9939 9924 -15
+ Misses 525 523 -2 🚀 New features to boost your workflow:
|
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds ChangesChunked transaction extraction and migration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ChunkedTransaction
participant Transaction
Client->>ChunkedTransaction: execute_all(client)
ChunkedTransaction->>ChunkedTransaction: validate and freeze chunks
loop each chunk
ChunkedTransaction->>ChunkedTransaction: select transaction ID and re-sign
ChunkedTransaction->>Transaction: execute(client)
Transaction-->>ChunkedTransaction: chunk response
end
ChunkedTransaction-->>Client: ordered responses
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hiero_sdk_python/consensus/topic_message_submit_transaction.py (1)
189-193: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winBLOCKER: Guard
_initial_transaction_idbefore serializing chunk info.
build_transaction_body()can be called directly on a multi-chunk message beforefreeze_with(), leaving_initial_transaction_idasNoneand crashing here. Proto field:chunkInfo.initialTransactionIDfield1. Issue type: oneof/wire-format lifecycle null-safety. (github.com)🐛 Suggested fix
# Multi-chunk metadata if self._total_chunks > 1: + if self._initial_transaction_id is None: + raise ValueError( + "Initial transaction ID must be set before building a multi-chunk topic message. " + "Call freeze_with(client) first." + ) body.chunkInfo.CopyFrom( consensus_submit_message_pb2.ConsensusMessageChunkInfo( initialTransactionID=self._initial_transaction_id._to_proto(),As per path instructions, "
_build_proto_body()callsself._initial_transaction_id._to_proto()when_total_chunks > 1... an explicit guard with a descriptiveValueErrorMUST be present."Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 563e667a-6375-4f1a-bc84-abfff5273cb8
📒 Files selected for processing (5)
src/hiero_sdk_python/consensus/topic_message_submit_transaction.pysrc/hiero_sdk_python/file/file_append_transaction.pysrc/hiero_sdk_python/transaction/chunked_transaction.pytests/integration/topic_message_submit_transaction_e2e_test.pytests/unit/chunked_transaction_test.py
|
Hello, this is the OfficeHourBot. This is a reminder that the Hiero Python SDK Office Hours will begin in approximately 2 hours and 57 minutes (14:00 UTC). This session provides an opportunity to ask questions regarding this Pull Request. Details:
Disclaimer: This is an automated reminder. Please verify the schedule here for any changes. From, |
|
Hi, this is WorkflowBot.
|
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
02d3111 to
f8bd8cf
Compare
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
cac35b2 to
c6d2eba
Compare
There was a problem hiding this comment.
lgtm, thanks @MonaaEid, please update the branch
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 47ad9cf2-88bb-4801-b98e-d8ef00433358
📒 Files selected for processing (2)
tests/integration/file_append_transaction_e2e_test.pytests/unit/chunked_transaction_test.py
|
👋 Hi @MonaaEid! Great work completing a Advanced issue! 🎉 Thanks for your contribution! 🚀 Here are some issues you might want to explore next:
🌟 Stay connected: Happy coding! 🚀 |
Description:
This pull request refactors the chunking and execution logic for both
TopicMessageSubmitTransactionandFileAppendTransactionby introducing and leveraging a newChunkedTransactionbase class. The changes simplify and centralize chunking functionality, improve message/content handling, and remove redundant or duplicated code from the transaction classes.Simplification and cleanup:
_validate_chunking,execute,execute_all, etc.) fromTopicMessageSubmitTransactionin favor of base class implementations.signmethod is simplified to delegate to the base class and support method chaining.Related issue(s):
Fixes #2300
Checklist